/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*   File:      AlterDataDialog.cpp
*   Author:    刘洋兵
*   Function:  修改/添加表数据的功能界面
*   Time:      2025-09-09
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include "AlterDataDialog.h"
#include "ui_AlterDataDialog.h"

#include <QDebug>

AlterDataDialog::AlterDataDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AlterDataDialog)
{
    ui->setupUi(this);
}

AlterDataDialog::~AlterDataDialog()
{
    delete ui;
}

/**
 * @brief  初始化指定界面数据以及部分内部数据
 * @param  table  QTableView控件对象指针
 * @param  index  table行索引
 * @param  operation_type  功能码
 */
void AlterDataDialog::display_specified_ViewWindow(QTableView* table,
                                                   const int& index,
                                                   const int& operation_type)
{
    QString tablename = table->objectName();
    _rowindex = index;
    _QView = table;
    QStandardItemModel* model = qobject_cast<QStandardItemModel*>(table->model());
    if(model->rowCount()>0)
        _Id = model->data(model->index(index,0)).toString();
    _operation_type = operation_type;

    if(tablename == "tableView_vehicle_profile") {
        setWindowTitle(QStringLiteral("车辆信息修改"));
        ui->stackedWidget->setCurrentIndex(0);
        ui->stackedWidget_vehicle_management->setCurrentIndex(0);
        static bool is_first = true;
        QString sql = "vehicle_name,ip_address,port";
        QString dbtablename = "tb_vehicle_profile";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_AGVname->clear();
        ui->comboBox_ip->clear();
        ui->comboBox_port->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_AGVname->addItem(dataList[row][0]);

            if(ui->comboBox_ip->findText(dataList[row][1]) == -1)
            {
                ui->comboBox_ip->addItem(dataList[row][1]);
            }
            if(ui->comboBox_port->findText(dataList[row][2]) == -1)
            {
                ui->comboBox_port->addItem(dataList[row][2]);
            }
        }
        if(is_first)
        {
            ui->comboBox_brand->addItem("睿芯行",1);
            ui->comboBox_brand->addItem("自研",0);

            ui->comboBox_vehicle_type->addItem("顶升车",1);
            ui->comboBox_vehicle_type->addItem("搬运车",2);
            ui->comboBox_vehicle_type->addItem("堆高车",3);

            ui->comboBox_battery_type->addItem("磷酸铁锂",0);

            ui->comboBox_is_available->addItem("可用",1);
            ui->comboBox_is_available->addItem("不可用",0);
            is_first = false;
        }
    }
    else if(tablename == "tableView_vehicle_status") {
        setWindowTitle(QStringLiteral("车辆状态信息"));
        ui->stackedWidget->setCurrentIndex(0);
        ui->stackedWidget_vehicle_management->setCurrentIndex(1);
        QString dbtablename = "tb_vehicle_status";
    }

    else if(tablename == "tableView") {
        setWindowTitle(QStringLiteral("告警信息修改"));
        ui->stackedWidget->setCurrentIndex(1);
        ui->stackedWidget_vehicle_fault->setCurrentIndex(0);
        QString sql = "fault_code,fault_info,fault_category";
        QString dbtablename = "tb_vehicle_fault";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_fault_code->clear();
        ui->comboBox_fault_info->clear();
        ui->comboBox_fault_category->clear();
        if(_operation_type == 1)
        {
            ui->comboBox_fault_code->setEditable(true);
        }
        else{
            ui->comboBox_fault_code->setEditable(false);
            ui->comboBox_fault_code->addItem(model->data(model->index(index,0)).toString());
        }
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_fault_info->addItem(dataList[row][1]);
            if(ui->comboBox_fault_category->findText(dataList[row][2]) == -1)
            {
                ui->comboBox_fault_category->addItem(dataList[row][2]);
            }
        }

    }

    else if (tablename == "tableView_map_config") {
        setWindowTitle(QStringLiteral("地图信息修改"));
        static bool is_first = true;
        ui->stackedWidget->setCurrentIndex(2);
        ui->stackedWidget_map_config->setCurrentIndex(0);

        if(is_first)
        {
            ui->comboBox_map_type->addItem("2D平面图",1);
            ui->comboBox_map_type->addItem("3D立体图",2);
            ui->comboBox_map_type->addItem("混合图",3);
            ui->comboBox_map_status->addItem("禁用",0);
            ui->comboBox_map_status->addItem("启动",1);
            ui->comboBox_map_status->addItem("维护中",2);
            is_first = false;
        }

        QString sql = "map_name,workshop_name,map_url,map_scale";
        QString dbtablename = "tb_map_config";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_map_name->clear();
        ui->comboBox_workshop_name->clear();
        ui->comboBox_map_url->clear();
        ui->comboBox_map_scale->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_map_name->addItem(dataList[row][0]);
            ui->comboBox_workshop_name->addItem(dataList[row][1]);
            ui->comboBox_map_url->addItem(dataList[row][2]);
            ui->comboBox_map_scale->addItem(dataList[row][3]);
        }
    }
    else if (tablename == "tableView_district_seats") {
        setWindowTitle(QStringLiteral("区域站点信息修改"));
        ui->stackedWidget->setCurrentIndex(2);
        ui->stackedWidget_map_config->setCurrentIndex(1);
        static bool is_first = true;
        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_name_seats->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_name_seats->addItem(dataList_map[row][0],dataList_map[row][0]);
        }
        if(is_first){
            ui->comboBox_district_type->addItem("默认区域",0);
            ui->comboBox_district_type->addItem("等待区",1);
            ui->comboBox_district_type->addItem("充电区",2);
            ui->comboBox_district_type->addItem("卸货区",3);
            is_first = false;
        }

        QString sql = "district_name,seat";
        QString dbtablename = "tb_district_seats";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_district_name->clear();
        ui->comboBox_seat->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_district_name->addItem(dataList[row][0]);
            ui->comboBox_seat->addItem(dataList[row][1]);
        }

    }
    else if (tablename == "tableView_nodes") {
        setWindowTitle(QStringLiteral("车辆站点信息"));
        ui->stackedWidget->setCurrentIndex(2);
        ui->stackedWidget_map_config->setCurrentIndex(2);
        static bool is_first = true;
        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_code_nodes->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_code_nodes->addItem(dataList_map[row][1],dataList_map[row][0]);
        }

        QString sql = "node_name";
        QString dbtablename = "tb_nodes";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_node_name_nodes->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_node_name_nodes->addItem(dataList[row][0]);
        }
        if(is_first)
        {
            ui->comboBox_node_type->addItem("普通节点",0);
            ui->comboBox_node_type->addItem("取货点",1);
            ui->comboBox_node_type->addItem("卸货点",2);
            ui->comboBox_node_type->addItem("充电点",3);
            ui->comboBox_node_type->addItem("等待点",4);
            ui->comboBox_node_type->addItem("停车点",5);

            ui->comboBox_relocate_pos->addItem("否",0);
            ui->comboBox_relocate_pos->addItem("是",1);
            is_first = false;
        }
    }
    else if (tablename == "tableView_paths") {
        setWindowTitle(QStringLiteral("车辆路径信息"));
        ui->stackedWidget->setCurrentIndex(2);
        ui->stackedWidget_map_config->setCurrentIndex(3);
        static bool is_first = true;
        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_name_paths->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_name_paths->addItem(dataList_map[row][1],dataList_map[row][0]);
        }

        QString sql_nodes = "node_id,node_name";
        QString dbtablename_nodes = "tb_nodes";
        QList<QStringList> dataList_nodes = MyDatabase::getInstance().query_some_tabledata(sql_nodes,dbtablename_nodes);
        int rowcount_nodes = dataList_nodes.count();
        ui->comboBox_start_name->clear();
        ui->comboBox_goal_name->clear();
        for (int row = 0; row < rowcount_nodes; row++) {
            ui->comboBox_start_name->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
            ui->comboBox_goal_name->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
        }

        QString sql = "path_name";
        QString dbtablename = "tb_paths";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_path_name->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_path_name->addItem(dataList[row][0]);
        }

        if(is_first)
        {
            ui->comboBox_direction->addItem("单向直线",0);
            ui->comboBox_direction->addItem("双向异向直线",1);
            ui->comboBox_direction->addItem("双向同向直线",2);
            ui->comboBox_direction->addItem("单向曲线",3);
            ui->comboBox_direction->addItem("双向异向曲线",4);
            ui->comboBox_direction->addItem("双向同向曲线",5);
            is_first = false;
        }
    }

    else if (tablename == "tableView_forward_obstacle_strategy") {
        setWindowTitle(QStringLiteral("前方避障策略修改"));
        ui->stackedWidget->setCurrentIndex(3);
        ui->stackedWidget_obstacle_avoidance->setCurrentIndex(0);
        static bool is_first = true;

        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_name_forward->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_name_forward->addItem(dataList_map[row][1],dataList_map[row][0]);
        }

        QString sql_path = "path_id,path_name";
        QString dbtablename_path = "tb_paths";
        QList<QStringList> dataList_path = MyDatabase::getInstance().query_some_tabledata(sql_path,dbtablename_path);
        int rowcount_path = dataList_path.count();
        ui->comboBox_path_name_forward->clear();
        for (int row = 0; row < rowcount_path; row++) {
            ui->comboBox_path_name_forward->addItem(dataList_path[row][1],dataList_path[row][0]);
        }

        QString sql_nodes = "node_id,node_name";
        QString dbtablename_nodes = "tb_nodes";
        QList<QStringList> dataList_nodes = MyDatabase::getInstance().query_some_tabledata(sql_nodes,dbtablename_nodes);
        int rowcount_nodes = dataList_nodes.count();
        ui->comboBox_start_name_forward->clear();
        ui->comboBox_goal_name_forward->clear();
        for (int row = 0; row < rowcount_nodes; row++) {
            ui->comboBox_start_name_forward->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
            ui->comboBox_goal_name_forward->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
        }
        if(is_first)
        {
            ui->comboBox_camera_switch_forward->addItem("开启",1);
            ui->comboBox_camera_switch_forward->addItem("关闭",0);

            ui->comboBox_laser_switch_forward->addItem("开启",1);
            ui->comboBox_laser_switch_forward->addItem("关闭",0);

            ui->comboBox_nav_back_switch_forward->addItem("开启",1);
            ui->comboBox_nav_back_switch_forward->addItem("关闭",0);

            ui->comboBox_nav_laser_switch_forward->addItem("开启",1);
            ui->comboBox_nav_laser_switch_forward->addItem("关闭",0);
            is_first = false;
        }
    }
    else if (tablename == "tableView_back_obstacle_strategy") {
        setWindowTitle(QStringLiteral("后方避障策略修改"));
        ui->stackedWidget->setCurrentIndex(3);
        ui->stackedWidget_obstacle_avoidance->setCurrentIndex(1);
        static bool is_first = true;

        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_name_back->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_name_back->addItem(dataList_map[row][1],dataList_map[row][0]);
        }

        QString sql_path = "path_id,path_name";
        QString dbtablename_path = "tb_paths";
        QList<QStringList> dataList_path = MyDatabase::getInstance().query_some_tabledata(sql_path,dbtablename_path);
        int rowcount_path = dataList_path.count();
        ui->comboBox_path_name_back->clear();
        for (int row = 0; row < rowcount_path; row++) {
            ui->comboBox_path_name_back->addItem(dataList_path[row][1],dataList_path[row][0]);
        }

        QString sql_nodes = "node_id,node_name";
        QString dbtablename_nodes = "tb_nodes";
        QList<QStringList> dataList_nodes = MyDatabase::getInstance().query_some_tabledata(sql_nodes,dbtablename_nodes);
        int rowcount_nodes = dataList_nodes.count();
        ui->comboBox_start_name_back->clear();
        ui->comboBox_goal_name_back->clear();
        for (int row = 0; row < rowcount_nodes; row++) {
            ui->comboBox_start_name_back->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
            ui->comboBox_goal_name_back->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
        }
        if(is_first)
        {
            ui->comboBox_camera_switch_back->addItem("开启",1);
            ui->comboBox_camera_switch_back->addItem("关闭",0);

            ui->comboBox_fork_obstacle_switch_back->addItem("开启",1);
            ui->comboBox_fork_obstacle_switch_back->addItem("关闭",0);

            ui->comboBox_laser_switch_back->addItem("开启",1);
            ui->comboBox_laser_switch_back->addItem("关闭",0);

            ui->comboBox_left_fork_laser_switch_back->addItem("开启",1);
            ui->comboBox_left_fork_laser_switch_back->addItem("关闭",0);

            ui->comboBox_right_fork_laser_switch_back->addItem("开启",1);
            ui->comboBox_right_fork_laser_switch_back->addItem("关闭",0);
            is_first = false;
        }
    }
    else if (tablename == "tableView_left_obstacle_strategy") {
        setWindowTitle(QStringLiteral("左方避障策略修改"));
        ui->stackedWidget->setCurrentIndex(3);
        ui->stackedWidget_obstacle_avoidance->setCurrentIndex(2);
        static bool is_first = true;

        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_name_left->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_name_left->addItem(dataList_map[row][1],dataList_map[row][0]);
        }

        QString sql_path = "path_id,path_name";
        QString dbtablename_path = "tb_paths";
        QList<QStringList> dataList_path = MyDatabase::getInstance().query_some_tabledata(sql_path,dbtablename_path);
        int rowcount_path = dataList_path.count();
        ui->comboBox_path_name_left->clear();
        for (int row = 0; row < rowcount_path; row++) {
            ui->comboBox_path_name_left->addItem(dataList_path[row][1],dataList_path[row][0]);
        }

        QString sql_nodes = "node_id,node_name";
        QString dbtablename_nodes = "tb_nodes";
        QList<QStringList> dataList_nodes = MyDatabase::getInstance().query_some_tabledata(sql_nodes,dbtablename_nodes);
        int rowcount_nodes = dataList_nodes.count();
        ui->comboBox_start_name_left->clear();
        ui->comboBox_goal_name_left->clear();
        for (int row = 0; row < rowcount_nodes; row++) {
            ui->comboBox_start_name_left->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
            ui->comboBox_goal_name_left->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
        }
        if(is_first)
        {
            ui->comboBox_camera_switch_left->addItem("开启",1);
            ui->comboBox_camera_switch_left->addItem("关闭",0);

            ui->comboBox_laser_switch_left->addItem("开启",1);
            ui->comboBox_laser_switch_left->addItem("关闭",0);

            ui->comboBox_nav_back_switch_left->addItem("开启",1);
            ui->comboBox_nav_back_switch_left->addItem("关闭",0);
            is_first = false;
        }
    }
    else if (tablename == "tableView_right_obstacle_strategy") {
        setWindowTitle(QStringLiteral("右方避障策略修改"));
        ui->stackedWidget->setCurrentIndex(3);
        ui->stackedWidget_obstacle_avoidance->setCurrentIndex(3);
        static bool is_first = true;

        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_name_right->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_name_right->addItem(dataList_map[row][1],dataList_map[row][0]);
        }

        QString sql_path = "path_id,path_name";
        QString dbtablename_path = "tb_paths";
        QList<QStringList> dataList_path = MyDatabase::getInstance().query_some_tabledata(sql_path,dbtablename_path);
        int rowcount_path = dataList_path.count();
        ui->comboBox_path_name_right->clear();
        for (int row = 0; row < rowcount_path; row++) {
            ui->comboBox_path_name_right->addItem(dataList_path[row][1],dataList_path[row][0]);
        }

        QString sql_nodes = "node_id,node_name";
        QString dbtablename_nodes = "tb_nodes";
        QList<QStringList> dataList_nodes = MyDatabase::getInstance().query_some_tabledata(sql_nodes,dbtablename_nodes);
        int rowcount_nodes = dataList_nodes.count();
        ui->comboBox_start_name_right->clear();
        ui->comboBox_goal_name_right->clear();
        for (int row = 0; row < rowcount_nodes; row++) {
            ui->comboBox_start_name_right->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
            ui->comboBox_goal_name_right->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
        }
        if(is_first)
        {
            ui->comboBox_camera_switch_right->addItem("开启",1);
            ui->comboBox_camera_switch_right->addItem("关闭",0);

            ui->comboBox_laser_switch_right->addItem("开启",1);
            ui->comboBox_laser_switch_right->addItem("关闭",0);

            ui->comboBox_nav_back_switch_right->addItem("开启",1);
            ui->comboBox_nav_back_switch_right->addItem("关闭",0);
            is_first = false;
        }
    }

    else if (tablename == "tableView_tasks") {
        setWindowTitle(QStringLiteral("任务修改"));
        ui->stackedWidget->setCurrentIndex(4);
        ui->stackedWidget_task->setCurrentIndex(0);
        static bool is_first = true;

        QString sql_map = "map_code,map_name";
        QString dbtablename_map = "tb_map_config";
        QList<QStringList> dataList_map = MyDatabase::getInstance().query_some_tabledata(sql_map,dbtablename_map);
        int rowcount_map = dataList_map.count();
        ui->comboBox_map_name_task->clear();
        for (int row = 0; row < rowcount_map; row++) {
            ui->comboBox_map_name_task->addItem(dataList_map[row][1],dataList_map[row][0]);
        }

        QString sql_vehicle = "vehicle_id,vehicle_name";
        QString dbtablename_vehicle = "tb_vehicle_profile";
        QList<QStringList> dataList_vehicle = MyDatabase::getInstance().query_some_tabledata(sql_vehicle,dbtablename_vehicle);
        int rowcount_vehicle = dataList_vehicle.count();
        ui->comboBox_vehicle_name_task->clear();
        for (int row = 0; row < rowcount_vehicle; row++) {
            ui->comboBox_vehicle_name_task->addItem(dataList_vehicle[row][1],dataList_vehicle[row][0]);
        }

        QString sql_nodes = "node_id,node_name";
        QString dbtablename_nodes = "tb_nodes";
        QList<QStringList> dataList_nodes = MyDatabase::getInstance().query_some_tabledata(sql_nodes,dbtablename_nodes);
        int rowcount_nodes = dataList_nodes.count();
        ui->comboBox_start_node->clear();
        ui->comboBox_goal_node->clear();
        for (int row = 0; row < rowcount_nodes; row++) {
            ui->comboBox_start_node->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
            ui->comboBox_goal_node->addItem(dataList_nodes[row][1],dataList_nodes[row][0]);
        }

        QString sql_group = "action_group_id,action_group_name";
        QString dbtablename_group = "tb_action_group";
        QList<QStringList> dataList_group = MyDatabase::getInstance().query_some_tabledata(sql_group,dbtablename_group);
        int rowcount_group = dataList_group.count();
        ui->comboBox_action_group->clear();
        for (int row = 0; row < rowcount_group; row++) {
            ui->comboBox_action_group->addItem(dataList_group[row][1],dataList_group[row][0]);
        }

        QString sql = "creator,task_name,transfer_trolley_id,path_plan_id,priority";
        QString dbtablename = "tb_tasks";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_creator->clear();
        ui->comboBox_task_name->clear();
        ui->comboBox_transfer_trolley_id->clear();
        ui->comboBox_path_plan_task->clear();
        ui->comboBox_priority->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_creator->addItem(dataList[row][0]);
            ui->comboBox_task_name->addItem(dataList[row][1]);
            ui->comboBox_transfer_trolley_id->addItem(dataList[row][2]);
            ui->comboBox_path_plan_task->addItem(dataList[row][3]);
            ui->comboBox_priority->addItem(dataList[row][4]);
        }

        if(is_first)
        {
            ui->comboBox_task_type->addItem("搬运任务",0);
            ui->comboBox_task_type->addItem("故障任务",1);
            ui->comboBox_task_type->addItem("单动作任务",2);
            ui->comboBox_task_type->addItem("去到某待命点任务",3);

            ui->comboBox_task_status->addItem("未执行",0);
            ui->comboBox_task_status->addItem("分配中",1);
            ui->comboBox_task_status->addItem("执行中",2);
            ui->comboBox_task_status->addItem("完成",3);
            ui->comboBox_task_status->addItem("人工辅助完成",4);
            ui->comboBox_task_status->addItem("已取消",5);
            ui->comboBox_task_status->addItem("暂停中",6);
            ui->comboBox_task_status->addItem("其它异常",7);
            is_first = false;
        }
    }

    else if(tablename == "tableView_vehicle_action_set") {
        setWindowTitle(QStringLiteral("动作修改"));
        ui->stackedWidget->setCurrentIndex(5);
        ui->stackedWidget_action->setCurrentIndex(0);
        static bool is_first = true;
        QString sql = "action_name,qr_code_id,shelves_name,function_code,exit_pose";
        QString dbtablename = "tb_vehicle_action_set";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_action_name->clear();
        ui->comboBox_qr_code_id->clear();
        ui->comboBox_shelves_name->clear();
        ui->comboBox_function_code->clear();
        ui->comboBox_exit_pose->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_action_name->addItem(dataList[row][0]);
            ui->comboBox_qr_code_id->addItem(dataList[row][1]);
            ui->comboBox_shelves_name->addItem(dataList[row][2]);
            ui->comboBox_function_code->addItem(dataList[row][3]);
            ui->comboBox_exit_pose->addItem(dataList[row][4]);
        }

        if(is_first)
        {
            ui->comboBox_action_type->addItem("无动作",-1);
            ui->comboBox_action_type->addItem("搬运车举升或下降",0);
            ui->comboBox_action_type->addItem("堆高车高度举升或下降",1);
            ui->comboBox_action_type->addItem("顶升车上升或下降",3);
            ui->comboBox_action_type->addItem("充电动作",4);
            ui->comboBox_action_type->addItem("车辆旋转",5);
            ui->comboBox_action_type->addItem("货物旋转",6);
            ui->comboBox_action_type->addItem("车辆旋转和货物旋转同时",7);
            ui->comboBox_action_type->addItem("顶升车货架识别",8);
            ui->comboBox_action_type->addItem("顶升车退出货架识别",9);
            ui->comboBox_action_type->addItem("功能码",16);
            ui->comboBox_action_type->addItem("货架名称",17);

            ui->comboBox_action->addItem("下降",0);
            ui->comboBox_action->addItem("上升",1);
            ui->comboBox_action->addItem("二维码校验上升",3);
            ui->comboBox_action->addItem("二维码校验下降",4);

            ui->comboBox_immediate_status->addItem("边走边动作",1);
            ui->comboBox_immediate_status->addItem("停车动作",0);

            ui->comboBox_drop_status->addItem("检查",1);
            ui->comboBox_drop_status->addItem("不检查",0);
            is_first = false;
        }
    }
    else if(tablename == "tableView_action_group") {
        setWindowTitle(QStringLiteral("动作组修改"));
        ui->stackedWidget->setCurrentIndex(5);
        ui->stackedWidget_action->setCurrentIndex(1);
        QString sql_action = "action_code,action_name";
        QString dbtablename_action = "tb_vehicle_action_set";
        QList<QStringList> dataList_action = MyDatabase::getInstance().query_some_tabledata(sql_action,dbtablename_action);
        int rowcount_action = dataList_action.count();
        ui->comboBox_start_action_code->clear();
        ui->comboBox_end_action_code->clear();
        for (int row = 0; row < rowcount_action; row++) {
            ui->comboBox_start_action_code->addItem(dataList_action[row][1],dataList_action[row][0]);
            ui->comboBox_end_action_code->addItem(dataList_action[row][1],dataList_action[row][0]);
        }

        QString sql = "action_group_name";
        QString dbtablename = "tb_action_group";
        QList<QStringList> dataList = MyDatabase::getInstance().query_some_tabledata(sql,dbtablename);
        int rowcount = dataList.count();
        ui->comboBox_action_group_name->clear();
        for (int row = 0; row < rowcount; row++) {
            ui->comboBox_action_group_name->addItem(dataList[row][0]);
        }
    }
    exec();
}


/**
 * @brief  **************发送指定任务的按键功能*******************
 */
void AlterDataDialog::on_pushButton_alter_vehicle_fault_clicked()
{
    QStringList dataList;
    QString fault_code = ui->comboBox_fault_code->currentText();
    QString fault_info = ui->comboBox_fault_info->currentText();
    QString fault_category = ui->comboBox_fault_category->currentText();
    QString fault_level = ui->spinBox_fault_level->text();

    dataList << fault_code << fault_info << fault_category << fault_level;
    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_vehicle_profile_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    infomap["table_name"] = "tb_vehicle_profile";
    infomap["operation_type"] = _operation_type;
    QStringList dataList;
    QString id = _Id;
    QString AGVname = ui->comboBox_AGVname->currentText();
    QString brand = ui->comboBox_brand->currentText();
    QString ip = ui->comboBox_ip->currentText();
    QString port = ui->comboBox_port->currentText();
    QString vehicle_type = ui->comboBox_vehicle_type->currentText();
    QString battery_type = ui->comboBox_battery_type->currentText();
    QString max_current = ui->doubleSpinBox_charge_max_current->text();
    QString max_voltage = ui->doubleSpinBox_charge_max_voltage->text();
    QString is_available = ui->comboBox_is_available->currentText();

    dataMap["vehicle_id"] = id.toInt();
    dataMap["vehicle_name"] = AGVname;
    dataMap["brand"] = ui->comboBox_brand->currentData().toInt();
    dataMap["ip_address"] = ip;
    dataMap["port"] = port.toInt();
    dataMap["vehicle_type"] = ui->comboBox_vehicle_type->currentData().toInt();
    dataMap["battery_type"] = ui->comboBox_battery_type->currentData().toInt();
    dataMap["charge_max_current"] = max_current.toDouble();
    dataMap["charge_max_voltage"] = max_voltage.toDouble();
    dataMap["is_available"] = ui->comboBox_is_available->currentData().toInt();
    //打包成json数据结构
    if(CommandSendorReceive::getInstance().isExecute("提示","确认修改小车信息"))
    {
        CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 202, true);
        dataList << id << AGVname << brand << ip << port << vehicle_type << battery_type << max_current << max_voltage << is_available;
        emit senddatalist(_QView, dataList, _rowindex);
    }

    close();
}

void AlterDataDialog::on_pushButton_ok_map_config_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    QStringList dataList;
    QString id = _Id;
    QString map_name = ui->comboBox_map_name->currentText();
    QString map_type = ui->comboBox_map_type->currentText();
    QString workshop_name = ui->comboBox_workshop_name->currentText();
    QString map_url = ui->comboBox_map_url->currentText();
    QString X = ui->doubleSpinBox_X->text();
    QString Y = ui->doubleSpinBox_Y->text();
    QString Z = ui->doubleSpinBox_Z->text();
    QString map_scale = ui->comboBox_map_scale->currentText();
    QString map_status = ui->comboBox_map_status->currentText();

    infomap["table_name"] = "tb_map_config";
    infomap["operation_type"] = _operation_type;
    dataMap["map_id"] = id;
    dataMap["map_name"] = map_name;
    dataMap["workshop_name"] = workshop_name;
    dataMap["map_url"] = map_url;
    dataMap["origin_x"] = X.toDouble();
    dataMap["origin_y"] = Y.toDouble();
    dataMap["origin_z"] = Z.toDouble();
    dataMap["map_scale"] = map_scale.toDouble();
    dataMap["map_status"] = ui->comboBox_map_status->currentData().toInt();
    dataMap["map_type"] = ui->comboBox_map_type->currentData().toInt();
    //打包成json数据结构
    CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 208, true);

    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< map_name << map_type << workshop_name << map_url << X << Y << Z << map_scale << map_status;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << map_name << map_type << workshop_name << map_url << X << Y << Z << map_scale << map_status;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_district_seats_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    QStringList dataList;
    QString id = _Id;
    QString map_name_seats = ui->comboBox_map_name_seats->currentText();
    QString district_name = ui->comboBox_district_name->currentText();
    QString district_type = ui->comboBox_district_type->currentText();
    QString seat = ui->comboBox_seat->currentText();

    infomap["table_name"] = "tb_district_seats";
    infomap["operation_type"] = _operation_type;
    dataMap["district_seat_id"] = id.toInt();
    dataMap["map_id"] = ui->comboBox_map_name_seats->currentData().toString();
    dataMap["district_name"] = district_name;
    dataMap["district_type"] = ui->comboBox_district_type->currentData().toInt();
    dataMap["seat"] = seat;
    //打包成json数据结构
    if(CommandSendorReceive::getInstance().isExecute("提示","确认修改区域座位信息"))
    {
        CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 205, true);

        if(_operation_type == 1)
        {
            QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
            dataList <<" "<< map_name_seats << district_name << district_type << seat;
            emit sendadddatalist(_QView, dataList, iconlist);
        }
        else if(_operation_type == 3){
            dataList << id << map_name_seats << district_name << district_type << seat;
            emit senddatalist(_QView, dataList, _rowindex);
        }
    }

    close();
}

void AlterDataDialog::on_pushButton_alter_nodes_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    QStringList dataList;
    QString id = _Id;
    QString map_code_nodes = ui->comboBox_map_code_nodes->currentText();
    QString node_name = ui->comboBox_node_name_nodes->currentText();
    QString node_type = ui->comboBox_node_type->currentText();
    QString X_nodes = ui->doubleSpinBox_X_nodes->text();
    QString Y_nodes = ui->doubleSpinBox_Y_nodes->text();
    QString Z_nodes = ui->doubleSpinBox_Z_nodes->text();
    QString relocate_pos = ui->comboBox_relocate_pos->currentText();
    QString angle = ui->doubleSpinBox_angle->text();

    infomap["table_name"] = "tb_nodes";
    infomap["operation_type"] = _operation_type;
    dataMap["node_id"] = id;
    dataMap["map_id"] = ui->comboBox_map_code_nodes->currentData().toString();
    dataMap["node_name"] = node_name;
    dataMap["node_type"] = ui->comboBox_node_type->currentData().toInt();
    dataMap["node_x"] = X_nodes.toDouble();
    dataMap["node_y"] = Y_nodes.toDouble();
    dataMap["node_z"] = Z_nodes.toDouble();
    dataMap["angle"] = angle.toDouble();
    dataMap["relocate_pos"] = ui->comboBox_relocate_pos->currentData().toInt();
    //打包成json数据结构
    CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 207, true);

    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< map_code_nodes << node_name << node_type << X_nodes << Y_nodes << Z_nodes << angle << relocate_pos;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << map_code_nodes << node_name << node_type << X_nodes << Y_nodes << Z_nodes << angle << relocate_pos;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_alter_paths_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    QStringList dataList;
    QString id = _Id;
    QString map_name_paths = ui->comboBox_map_name_paths->currentText();
    QString path_name = ui->comboBox_path_name->currentText();
    QString start_name = ui->comboBox_start_name->currentText();
    QString goal_name = ui->comboBox_goal_name->currentText();
    QString X1 = ui->doubleSpinBox_X1->text();
    QString Y1 = ui->doubleSpinBox_Y1->text();
    QString X2 = ui->doubleSpinBox_X2->text();
    QString Y2 = ui->doubleSpinBox_Y2->text();
    QString direction = ui->comboBox_direction->currentText();
    QString forward_path_angle = ui->doubleSpinBox_forward_path_angle->text();
    QString reverse_path_angle = ui->doubleSpinBox_reverse_path_angle->text();
    QString path_length = ui->doubleSpinBox_path_length->text();
    QString path_width = ui->doubleSpinBox_path_width->text();

    infomap["table_name"] = "tb_paths";
    infomap["operation_type"] = _operation_type;
    dataMap["path_id"] = id.toInt();
    dataMap["map_id"] = ui->comboBox_map_name_paths->currentData().toString();
    dataMap["path_name"] = path_name;
    dataMap["start_name"] = ui->comboBox_start_name->currentData().toString();
    dataMap["goal_name"] = ui->comboBox_goal_name->currentData().toString();
    dataMap["control_1_x"] = X1.toDouble();
    dataMap["control_1_y"] = Y1.toDouble();
    dataMap["control_2_x"] = X2.toDouble();
    dataMap["control_2_y"] = Y2.toDouble();
    dataMap["direction"] = ui->comboBox_direction->currentData().toInt();
    dataMap["forward_path_angle"] = forward_path_angle.toDouble();
    dataMap["reverse_path_angle"] = reverse_path_angle.toDouble();
    dataMap["path_length"] = path_length.toDouble();
    dataMap["path_width"] = path_width.toDouble();
    //打包成json数据结构
    CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 209, true);

    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< map_name_paths << path_name << start_name << goal_name << X1 << Y1 << X2 << Y2
                 << direction << forward_path_angle << reverse_path_angle << path_length << path_width;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << map_name_paths << path_name << start_name << goal_name << X1 << Y1 << X2 << Y2
                 << direction << forward_path_angle << reverse_path_angle << path_length << path_width;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_forward_obstacle_strategy_clicked()
{
    QStringList dataList;
    QString id = _Id;
    QString map_name = ui->comboBox_map_name_forward->currentText();
    QString path_name = ui->comboBox_path_name_forward->currentText();
    QString start_name = ui->comboBox_start_name_forward->currentText();
    QString goal_name = ui->comboBox_goal_name_forward->currentText();

    QString camera_range = ui->spinBox_camera_range_forward->text();
    QString camera_switch = ui->comboBox_camera_switch_forward->currentText();
    QString laser_range = ui->spinBox_laser_range_forward->text();
    QString laser_switch = ui->comboBox_laser_switch_forward->currentText();

    QString nav_back_range = ui->spinBox_nav_back_range_forward->text();
    QString nav_back_switch = ui->comboBox_nav_back_switch_forward->currentText();
    QString nav_laser_range = ui->spinBox_nav_laser_range_forward->text();
    QString nav_laser_switch = ui->comboBox_nav_laser_switch_forward->currentText();
    QString path_speed = ui->spinBox_path_speed_forward->text();

    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< map_name << path_name << start_name << goal_name << camera_range << camera_switch << laser_range << laser_switch
                 << nav_back_range << nav_back_switch << nav_laser_range << nav_laser_switch << path_speed;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << map_name << path_name << start_name << goal_name << camera_range << camera_switch << laser_range << laser_switch
                 << nav_back_range << nav_back_switch << nav_laser_range << nav_laser_switch << path_speed;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_back_obstacle_strategy_clicked()
{
    QStringList dataList;
    QString id = _Id;
    QString map_name = ui->comboBox_map_name_back->currentText();
    QString path_name = ui->comboBox_path_name_back->currentText();
    QString start_name = ui->comboBox_start_name_back->currentText();
    QString goal_name = ui->comboBox_goal_name_back->currentText();

    QString camera_range = ui->spinBox_camera_range_back->text();
    QString camera_switch = ui->comboBox_camera_switch_back->currentText();
    QString obstacle_switch = ui->comboBox_fork_obstacle_switch_back->currentText();
    QString laser_range = ui->spinBox_laser_range_back->text();
    QString laser_switch = ui->comboBox_laser_switch_back->currentText();

    QString left_fork_laser_range = ui->spinBox_left_fork_laser_range_back->text();
    QString left_fork_laser_switch = ui->comboBox_left_fork_laser_switch_back->currentText();
    QString right_fork_laser_range = ui->spinBox_right_fork_laser_range_back->text();
    QString right_fork_laser_switch = ui->comboBox_right_fork_laser_switch_back->currentText();
    QString path_speed = ui->spinBox_path_speed_back->text();

    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< map_name << path_name << start_name << goal_name << camera_range << camera_switch << obstacle_switch << laser_range << laser_switch
                 << left_fork_laser_range << left_fork_laser_switch << right_fork_laser_range << right_fork_laser_switch << path_speed;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << map_name << path_name << start_name << goal_name << camera_range << camera_switch << obstacle_switch << laser_range << laser_switch
                 << left_fork_laser_range << left_fork_laser_switch << right_fork_laser_range << right_fork_laser_switch << path_speed;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_left_obstacle_strategy_clicked()
{
    QStringList dataList;
    QString id = _Id;
    QString map_name = ui->comboBox_map_name_left->currentText();
    QString path_name = ui->comboBox_path_name_left->currentText();
    QString start_name = ui->comboBox_start_name_left->currentText();
    QString goal_name = ui->comboBox_goal_name_left->currentText();

    QString camera_range = ui->spinBox_camera_range_left->text();
    QString camera_switch = ui->comboBox_camera_switch_left->currentText();
    QString laser_range = ui->spinBox_laser_range_left->text();
    QString laser_switch = ui->comboBox_laser_switch_left->currentText();

    QString nav_back_range = ui->spinBox_nav_back_range_left->text();
    QString nav_back_switch = ui->comboBox_nav_back_switch_left->currentText();
    QString path_speed = ui->spinBox_path_speed_left->text();
    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< map_name << path_name << start_name << goal_name << camera_range << camera_switch << laser_range << laser_switch
                 << nav_back_range << nav_back_switch << path_speed;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << map_name << path_name << start_name << goal_name << camera_range << camera_switch << laser_range << laser_switch
                 << nav_back_range << nav_back_switch << path_speed;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_right_obstacle_strategy_clicked()
{
    QStringList dataList;
    QString id = _Id;
    QString map_name = ui->comboBox_map_name_right->currentText();
    QString path_name = ui->comboBox_path_name_right->currentText();
    QString start_name = ui->comboBox_start_name_right->currentText();
    QString goal_name = ui->comboBox_goal_name_right->currentText();

    QString camera_range = ui->spinBox_camera_range_right->text();
    QString camera_switch = ui->comboBox_camera_switch_right->currentText();
    QString laser_range = ui->spinBox_laser_range_right->text();
    QString laser_switch = ui->comboBox_laser_switch_right->currentText();

    QString nav_back_range = ui->spinBox_nav_back_range_right->text();
    QString nav_back_switch = ui->comboBox_nav_back_switch_right->currentText();
    QString path_speed = ui->spinBox_path_speed_right->text();
    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< map_name << path_name << start_name << goal_name << camera_range << camera_switch << laser_range << laser_switch
                 << nav_back_range << nav_back_switch << path_speed;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << map_name << path_name << start_name << goal_name << camera_range << camera_switch << laser_range << laser_switch
                 << nav_back_range << nav_back_switch << path_speed;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_tasks_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    QStringList dataList;
    QString id = _Id;
    QString source_task_id = ui->comboBox_source_task_id->currentText();
    QString creator = ui->comboBox_creator->currentText();
    QString task_name = ui->comboBox_task_name->currentText();
    QString task_type = ui->comboBox_task_type->currentText();
    QString transfer_trolley_id = ui->comboBox_transfer_trolley_id->currentText();
    QString map_name_task = ui->comboBox_map_name_task->currentText();
    QString vehicle_name_task = ui->comboBox_vehicle_name_task->currentText();
    QString priority = ui->comboBox_priority->currentText();
    QString start_node = ui->comboBox_start_node->currentText();
    QString goal_node = ui->comboBox_goal_node->currentText();
    QString action_group = ui->comboBox_action_group->currentText();
    QString task_status = ui->comboBox_task_status->currentText();
    QString path_plan_task = ui->comboBox_path_plan_task->currentText();

    infomap["table_name"] = "tb_tasks";
    infomap["operation_type"] = _operation_type;
    dataMap["task_id"] = id.toInt();
    dataMap["task_status"] = ui->comboBox_task_status->currentData().toInt();
    //打包成json数据结构
    CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 201, true);

    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Cancel,Icon_Edit};
        dataList <<" "<< source_task_id << creator << task_name << task_type << transfer_trolley_id << map_name_task << vehicle_name_task << priority
                 << start_node << goal_node << action_group << task_status << path_plan_task;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << source_task_id << creator << task_name << task_type << transfer_trolley_id << map_name_task << vehicle_name_task << priority
                 << start_node << goal_node << action_group << task_status << path_plan_task;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_vehicle_action_set_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    QStringList dataList;
    QString id = _Id;
    QString action_name = ui->comboBox_action_name->currentText();
    QString action_type = ui->comboBox_action_type->currentText();
    QString action_height = ui->doubleSpinBox_action_height->text();
    QString action = ui->comboBox_action->currentText();
    QString immediate_status = ui->comboBox_immediate_status->currentText();
    QString qr_code_id = ui->comboBox_qr_code_id->currentText();
    QString rotate_angle = ui->doubleSpinBox_rotate_angle->text();
    QString goods_angle = ui->doubleSpinBox_goods_angle->text();
    QString drop_status = ui->comboBox_drop_status->currentText();
    QString shelves_name = ui->comboBox_shelves_name->currentText();
    QString function_code = ui->comboBox_function_code->currentText();
    QString exit_pose = ui->comboBox_exit_pose->currentText();
    QString speed = ui->doubleSpinBox_speed->text();

    infomap["table_name"] = "tb_vehicle_action_set";
    infomap["operation_type"] = _operation_type;
    dataMap["action_code"] = id.toInt();
    dataMap["action_name"] = action_name;
    dataMap["action_type"] = ui->comboBox_action_type->currentData().toInt();
    dataMap["action_height"] = action_height.toDouble();
    dataMap["action"] = ui->comboBox_action->currentData().toInt();
    dataMap["immediate_status"] = ui->comboBox_immediate_status->currentData().toInt();
    dataMap["qr_code_id"] = qr_code_id.toInt();
    dataMap["rotate_angle"] = rotate_angle.toDouble();
    dataMap["goods_angle"] = goods_angle.toDouble();
    dataMap["drop_status"] = ui->comboBox_drop_status->currentData().toInt();
    dataMap["shelves_name"] = shelves_name;
    dataMap["function_code"] = function_code;
    dataMap["exit_pose"] = exit_pose;
    dataMap["speed"] = speed.toDouble();
    //打包成json数据结构
    CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 204, true);

    if(_operation_type == 1)
    {
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< action_name << action_type << action_height << action << immediate_status << qr_code_id << rotate_angle << goods_angle
                 << drop_status << shelves_name << function_code << exit_pose << speed;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << action_name << action_type << action_height << action << immediate_status << qr_code_id << rotate_angle << goods_angle
                 << drop_status << shelves_name << function_code << exit_pose << speed;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}

void AlterDataDialog::on_pushButton_ok_action_group_clicked()
{
    //发送数据类
    QMap<QString, QVariant> infomap;
    QMap<QString, QVariant> dataMap;
    QStringList dataList;
    QString id = _Id;
    QString action_group_name = ui->comboBox_action_group_name->currentText();
    QString start_action_code = ui->comboBox_start_action_code->currentText();
    QString end_action_code = ui->comboBox_end_action_code->currentText();

    infomap["table_name"] = "tb_action_group";
    infomap["operation_type"] = _operation_type;
    dataMap["action_group_id"] = id.toInt();
    dataMap["action_group_name"] = action_group_name;
    dataMap["start_action_code"] = ui->comboBox_start_action_code->currentData().toInt();
    dataMap["end_action_code"] = ui->comboBox_end_action_code->currentData().toInt();
    //打包成json数据结构
    CommandSendorReceive::getInstance().sendCommand(dataMap, infomap, 203, true);

    if(_operation_type == 1)
    {
        QMap<QString, bool> function_bool;
        QList<IconNumber> iconlist = {Icon_Delete,Icon_Edit};
        dataList <<" "<< action_group_name << start_action_code << end_action_code;
        emit sendadddatalist(_QView, dataList, iconlist);
    }
    else if(_operation_type == 3){
        dataList << id << action_group_name << start_action_code << end_action_code;
        emit senddatalist(_QView, dataList, _rowindex);
    }
    close();
}


